Constraints
| Kind of class: | class |
|---|---|
| Inherits from: | none |
| Classpath: | gfx.utils.Constraints |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
The Constraints utility helps symbols scale and align the assets contained within them. Elements can be added to a Constraints instance, and they will be reflowed when the
This utility supports both re-scaling and counter-scaling methods. Rescaling occurs when the component is scaled back to 100%, and the assets are reflowed and scaled to look correct. Counter-scaling occurs when the component is left at its transformed size, and the assets are scaled inversely to the parent clip.
update(width,height) method is called.This utility supports both re-scaling and counter-scaling methods. Rescaling occurs when the component is scaled back to 100%, and the assets are reflowed and scaled to look correct. Counter-scaling occurs when the component is left at its transformed size, and the assets are scaled inversely to the parent clip.
Summary
Constructor
- Constraints
- Create a new Constraints instance to assist in the positioning and scaling of an asset inside a component.
Class properties
- LEFT
- A constant ENUM value representing the left edge of the component
- RIGHT
- A constant ENUM value representing the right edge of the component
- TOP
- A constant ENUM value representing the top edge of the component
- BOTTOM
- A constant ENUM value representing the the bottom edge of the component
- ALL
- A constant ENUM value representing the the left, right, top, and bottom edges of the component
Instance properties
Instance methods
- addElement
- Add an element to this constraints instance.
- removeElement
- Remove an element from this Constraints instance
- getElement
- Get the contraints rules for a given object.
- update
- Change the width/height and x/y of each registered component based on the scope's updated size and the constraint rules.
Constructor
Constraints
function Constraints (
scope:MovieClip,
scaled:Boolean)
Create a new Constraints instance to assist in the positioning and scaling of an asset inside a component.
Parameters:
scope :
The component scope which contains the constrained asset.
scaled:
Determines if the component is counter-scaled (
true) or not (false).Class properties
ALL
static ALL:Number = LEFT | RIGHT | TOP | BOTTOM
(read,write)
A constant ENUM value representing the the left, right, top, and bottom edges of the component
BOTTOM
static BOTTOM:Number = 8
(read,write)
A constant ENUM value representing the the bottom edge of the component
LEFT
static LEFT:Number = 1
(read,write)
A constant ENUM value representing the left edge of the component
RIGHT
static RIGHT:Number = 2
(read,write)
A constant ENUM value representing the right edge of the component
TOP
static TOP:Number = 4
(read,write)
A constant ENUM value representing the top edge of the component
Instance properties
scaled
scaled:Boolean = false
(read,write)
Use a counter-scaling mode instead of a reflowing mode if this property is set to true.
scope
scope:Object
(read,write)
The container component that the constraints are applied to.
Instance methods
addElement
function addElement (
clip:Object,
edges:Number) : Void
Add an element to this constraints instance.
Parameters:
clip :
The MovieClip to add as a constrained element.
constraints:
The constraining edges. A bitwise number which can contain any combination of edge parameters.
getElement
function getElement (
clip:Object) : Object
Get the contraints rules for a given object.
Parameters:
clip:
A reference to the MovieClip the contraints apply to.
Returns:
- the constraints rules object for the specified clip
removeElement
function removeElement (
clip:MovieClip) : Void
Remove an element from this Constraints instance
Parameters:
clip:
A reference to the MovieClip to remove.
update
function update (
width:Number,
height:Number) : Void
Change the width/height and x/y of each registered component based on the scope's updated size and the constraint rules.
Parameters:
width :
The new width of the scope component.
height:
The new height of the scope component.